
package ClientGraphics;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;

/**
 *
 * @author mhfowler
 */
public class RenderThread extends Thread {

    GraphicsMain parent;
    Timer time;

    /* constructor */
    public RenderThread(int frameInterval, GraphicsMain g) {
        parent = g;
        time = new Timer(frameInterval, null);
    }


    @Override
    public void run() {
        time.addActionListener(new TickListener());
        time.start();
    }
    
    public void stopTimer() {
        time.stop();
    }

    public void reStartTimer() {
        time.start();
    }


    private class TickListener implements ActionListener {

        public void actionPerformed(ActionEvent e) {
            parent.render();
        }

    }


}
